package com.hl.apple.myapplication

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import com.lzy.okgo.OkGo
import com.lzy.okgo.callback.StringCallback
import com.lzy.okgo.model.Response
import kotlinx.android.synthetic.main.activity_douyin.*

class DouyinActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_douyin)
        initView()
    }

    fun initView() {

        getData()
        btn.setOnClickListener {
            getDetail()
        }

    }

    fun getData() {
        OkGo.get<String>(Constant.DOUYIN)
                .execute(object : StringCallback() {
                    override fun onSuccess(response: Response<String>) {
                        println(response.body())
                        Log.e("000000", "---:  " + response.body())

                    }
                })
    }

    fun getDetail() {
        OkGo.get<String>(Constant.DOUYIN_DET)
                .execute(object : StringCallback() {
                    override fun onSuccess(response: Response<String>) {
                        println(response.body())
                        Log.e("000000", "---:  " + response.body())

                    }
                })
    }
}